#include "environmental.h"
#include "ui_environmental.h"

environmental::environmental(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::environmental)
{
    ui->setupUi(this);
    this->resize(1774,1000);
    NKlabel=new QLabel(this);
    NKmovie=new QMovie(":/Libgif.gif");
    NKlabel->setMinimumSize(1774,1000);//设置标签为最小尺寸

    //QSize si(this->width(),this->height());
    //NKmovie->setScaledSize(si);// 将QMovie与标记相关联
    //NKmovie->setSpeed(100);//设置标签和按钮属性
        NKlabel->setMovie(NKmovie);
        NKmovie->start();
        QObject::connect(NKmovie,&QMovie::frameChanged,[=](){
            int currentFrameNumber = NKmovie->currentFrameNumber();
            int framecount = NKmovie->frameCount();
            if (currentFrameNumber == framecount-1)//如果已经播放到最后一帧，则停止播放
            {
                //NKmovie->stop();
                //this->close();
            }
        });
        QObject::connect(NKmovie, SIGNAL(frameChanged(int)), this, SLOT(onFrameChanged(int)));
    
}

environmental::~environmental()
{
    delete ui;
}
